(function ({form, table, layer, laydate, assessInQuiryTableIns,tableDoneSelect,tableDoneDatas,beforeTableDoneSelect, checkboxTArr,checkboxFArr,page,url,contentType, ok, AjaxFn}) {

    form.render(),form.on('checkbox(checkbox-t)', ({elem,value,othis,index=0})=>(elem.checked?(checkboxTArr.push(value)):(index = checkboxTArr.find(v=>v.value==value),index!=-1?checkboxTArr.splice(index,1):''), checkboxTArr.length>0?$(".checkbox-f input[type=checkbox]").attr("disabled","disabled"):$(".checkbox-f input[type=checkbox]").prop("disabled",false), form.render())),

    form.on('checkbox(checkbox-f)',({elem,value,othis,index=0})=>(elem.checked?(checkboxFArr.push(value)):(index = checkboxFArr.find(v=>v.value==value),index!=-1?checkboxFArr.splice(index,1):''), checkboxFArr.length>0?$(".checkbox-t input[type=checkbox]").attr("disabled","disabled"):$(".checkbox-t input[type=checkbox]").prop("disabled",false), form.render())),

    assessInQuiryTableIns = table.render({
        elem: '#assessInQuiryTable',
        /*url: url + "assessInQuiryTableDatas",*/
        method: 'post',
        contentType,
        page,
        cols: [
            [
                {title: '序号', type: 'numbers', fixed: "left", unresize: true, align: "center", width: 50, minWidth: 30},
                {field: 'vstaffname', title: '员工姓名', unresize: true, align: "center",width:130,minWidth: 130,},
                {field: 'vfactoryflgname', title: '工厂', unresize: true, align: "center",width:120,minWidth: 120,},
                {field: 'vpositionname', title: '职位', unresize: true, align: "center", minWidth: 100},
                {field: 'vteamname', title: '班组', unresize: true, align: "center",minWidth: 100},
                {field: 'vselfappmonth', title: '自我评定', unresize: true, align: "center", width:120,minWidth: 120,},
                {field: 'vteamappmonth', title: '班组评定', unresize: true, align: "center", width:120,minWidth: 120,},
                {field: 'vcustomerappmonth', title: '客户评定', unresize: true, align: "center",width:120,minWidth: 120,},
                {field: 'vgroupappmonth', title: '评定组评定', unresize: true, align: "center", width:120,minWidth: 120,},
            ]
        ],
        data:[]
        ,done: (res, curr, count) => (tableDoneDatas = res.data, beforeTableDoneSelect.checkbox=="checkboxFArr"&&res.data.length>0?$(".notification").prop("disabled",false).removeClass("layui-btn-disabled"):$(".notification").prop("disabled",true).addClass("layui-btn-disabled"))
    }),

    form.on('submit(assessInQuiryFormSubmit)',({field})=>{
        checkboxTArr.length>0||checkboxFArr.length>0?(
            field = tableDoneSelect(field),
            checkboxTArr.length>0?field.checkbox="checkboxTArr":checkboxFArr.length>0?field.checkbox="checkboxFArr":"",
            assessInQuiryTableIns.reload({
                url: url + "assessInQuiryTableDatas",
                where:field,
                page:{curr: 1}
            }),
            beforeTableDoneSelect=field
        ):layer.msg("请选择查询类型",{icon:7,time:2000})

        return false;
    }),

    $(".notification").click((res={})=>(beforeTableDoneSelect.checkbox=="checkboxFArr"&&tableDoneDatas.length>0?(res = AjaxFn(url+"notification",JSON.stringify(beforeTableDoneSelect),res),res.code==200?layer.msg(res.msg,{icon:1,time:1000}):layer.msg(res.msg,{icon:5,time:1000})):""))
})({
    form: layui.form,
    table: layui.table,
    layer: layui.layer,
    laydate: layui.laydate,
    assessInQuiryTableIns: '',
    tableDoneDatas:[],
    beforeTableDoneSelect:{},
    checkboxTArr:[],
    checkboxFArr:[],
    url: "/evaluation/AssessInQuiry/",
    contentType: 'application/json;charset=utf-8',
    page: {
        first: '首页',
        last: '尾页',
        prev: '上一页',
        next: '下一页',
        layout: ['count', 'prev', 'page', 'next'], groups: 5,
        theme: '#1e9fff',
        limits: [10, 20, 30, 40, 50],
    },
    ok: function (msg, icon) {
        layui.layer.confirm(msg, {
            id: "ok",
            icon: icon,
            anim: 4,
            title: '提示',
            btn: ['确定'],
            closeBtn: false,
            success: function (layero) {
                var btn = layero[0].getElementsByClassName('layui-layer-btn')[0].getElementsByTagName('A')[0];
                btn.href = 'javascript:void(0)';
                btn.focus();
            },
            yes: function (index, layero) {
                layer.close(index); //再执行关闭
            },
            end: function () {
                var index2 = parent.layer.getFrameIndex(window.name);
                parent.layer.closeAll();
            }
        });
    },
    AjaxFn: function (url, data, resource) {
        $.ajax({
            url,
            contentType: 'application/json;charset=utf-8',
            type: 'post',
            async: false,
            data,
            success: function (res) {
                let {msg='',code=''} =res;
                msg=='' && code==''? top.location.reload() : "";
                resource = res;
            }
        });
        return resource;
    },
    tableDoneSelect:(field)=>{
        let {vselfappmonth='',vteamappmonth='',vcustomerappmonth='',vgroupappmonth=''} = field
        return {vselfappmonth,vteamappmonth,vcustomerappmonth,vgroupappmonth}
    }
})